<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //按键弹起触发 onkeyup
        document.onkeyup = function(){
            console.log('我弹起了');
        }
        //按键按下触发 onkeydown
        document.addEventListener('keydown',function(){
            console.log('我按下了');
        })
        //按键按下触发 onkeypress 不识别功能键，Ctrl、shift等
        document.addEventListener('keypress',function(){
            console.log('按下');
        })
        //先执行down，再执行press
        //三个事件的执行顺序  keydown -- keypress -- keyup
    </script>
</body>
</html>